home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Multimedia & Desktop / sk8 / SK8InJava / Code / Actors / MouseDownEventMode.java < prev    next >
Encoding:
Java Source  |  1997-02-27  |  1.1 KB  |  44 lines  |  [TEXT/CWIE]

  1. /*  SK8 © 1997 Apple Computer, Inc.
  2.     This code is protected under the current SK8 License
  3.     See http://sk8.research.apple.com/ for more information
  4.     Apple Research Laboratories
  5. */
  6.  
  7. import java.awt.*;
  8.  
  9. // only called when the original target autohighlights. 
  10.  
  11. class mousedowneventmode extends eventmode {
  12.  
  13.     // slots.
  14.  
  15.     public actor originaltarget = null;
  16.  
  17.     // the main function!
  18.  
  19.     // on idle check if the current actor is no longer the original target.
  20.     
  21.     public void handleidle (Event e) {
  22.         if (sk8.eventactor() == this.originaltarget) {
  23.             if (this.originaltarget.highlight() == false) 
  24.                 this.originaltarget.sethighlight(true);
  25.         } else {
  26.             if (this.originaltarget.highlight() == true) 
  27.                 this.originaltarget.sethighlight(false);
  28.         }
  29.     }
  30.             
  31.     // on mouse up, leave the mode and send a mouseup only if the actor to get it
  32.     // is the original target. 
  33.     
  34.     public void handlemouseup (Event e) {
  35.         this.exitmode();
  36.         this.originaltarget.sethighlight(false);
  37.         if (sk8.eventactor() == this.originaltarget) 
  38.             this.originaltarget.mouseup();
  39.         this.originaltarget = null;
  40.     }
  41.     
  42.  
  43.